//
//  TPPermissionNotificationTools.h
//  Pods
//
//  Created by caixun on 16/1/22.
//   MPTAuthorizationNotificationTools *push = [MPTAuthorizationNotificationTools sharedInstance];
// UIUserNotificationSettings *setting = [UIUserNotificationSettings
//  settingsForTypes:(UIUserNotificationTypeSound |
//                    UIUserNotificationTypeAlert |
//                   UIUserNotificationTypeBadge)
//  categories:nil];
//   push.userNotificationSettings = setting;
//   [push authorize:^(MPE_AuthorizationStatus status, NSError * _Nullable error) {}];
//

#import <Foundation/Foundation.h>
#import "MPBAuthorizationBaseTools.h"


NS_ASSUME_NONNULL_BEGIN


@interface MPTAuthorizationNotificationTools : MPBAuthorizationBaseTools


/**
 * For iOS 8 set this for the notification types you want to register for.  If not set, it uses
 * Alert, Badge, and Sound notification types.
 */
@property(nonatomic) UIUserNotificationSettings *userNotificationSettings;

/**
 * For iOS 7 set this for the notification types you want to register for.  If not set, it uses
 * Alert, Badge, and Sound notification types.
 */
@property(nonatomic) UIRemoteNotificationType remoteNotificationType;



+ (instancetype)sharedInstance;

- (void)authorize:(NotificationAuthorizationHandler)completion;

/**
 *  Removes the apps push notification authorization at the system level and
 * clears the cached deviceID.
 */
- (void)unauthorize;

/**
 *  This callback must be called in the AppDelegate or else your push
 *notification handler may not be called
 *
 *- (void)application:(UIApplication *)application
 *didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
 *   [[MPTAuthorizationNotificationTools sharedInstance] notificationResult:deviceToken error:nil];
 *}
 *
 *- (void)application:(UIApplication *)application
 *didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
 *   [[MPTAuthorizationNotificationTools sharedInstance] notificationResult:nil error:error];
 *}
 *
 *  @param deviceToken the deviceToken from
 *didRegisterForRemoteNotificationsWithDeviceToken
 *  @param error       the error from
 *didFailToRegisterForRemoteNotificationsWithError
 */
- (void)notificationResult:(NSData *__nullable)deviceToken error:(NSError *__nullable)error;

/**
 *  The device ID that was previously obtained during an authorizeNotifications
 *call
 *
 *  @return the deviceID with <,>, and spaces removed
 */
- (NSString *__nullable)deviceID;


@end

NS_ASSUME_NONNULL_END
